We manage multiple WHMCS installations, all with our hooks. Every time we need to upgrade an hook it is necessary to check the old one, change the settings, then upload it.
In the past we made a setting file with a big array for every WHMCS installation, but that way is still suboptimal. We had many errors.
So we decided to create a module that will store the settings in the database. This way the files are exactly the same for every installation, and when we need to update something all we have to do is to upload the new files, and everything will work perfectly.
Download NowTo install this copy the "hooks_settings" folder and its content inside WHMCS/modules/addons.
Then from the admin area go on Setup -> AddonModules
Then activate the module and configure it to give access to the admin groups you prefer
The module is now functional. It is extremely easy to use, but let's see it together. First of all we have to access the module page from Addons -> WHMCS Tricks Hooks Settings
Will see a form and a list of all the existing settings.
Please note that both fields in the form have to be filled, you can't save an empty setting. Also note that the setting has to be unique to avoid confusion. The module will check for both this condition and send back an error if you make a mistake.
Once you add the settings you'll see them below and you will be able to delete or edit them.
The module allows you to add the setting using a simple form. Just enter the setting and the value and click on "Save Changes" in the form. This allows you to create a setting for any hook you may want to use.
For our Custom Hooks you will see the setting below the form, and you can click on them to add them to the form. This will reduce the error, and give you some additional informations about the setting itself. Hovering over the information icon will open a tooltip with a brief description, while clicking on it will open the description page.
If you want to make the suggestions available for your own hooks, all you have to do is to create the "whmcstricks_config_" function. The code, as you can see below it's self-explanatory. All you have to do is to create a function with your setting name, and prepend "whmcstricks_config_" to the setting name.
Then add a text for the tooltip and a text for the description page.
function whmcstricks_config_jotform_authcode_id() { return array( 'info' => 'tooltip text', 'description' => 'text for the description page. Supports HTML', ); }
To use the settings you saved into the php code of your hooks is pretty easy.
you can decide to retrieve all the settings, or one at a time.
To get all the settings and put them into an array you should add this line of code as soon as you need the settings
$settings = whmcstricks_get_hooks_config();
It will then be accessible as an array using the setting as key and the value as value:
echo $settings['setting'];
You may also want to only get one setting, in this case you can use this code:
Download Now$setting = whmcstricks_get_hooks_config('setting');
Got questions or problems? Contact us or comment, we'll be happy to help.
[…] plugin requires the Custom module to manage hooks settings or you will need to edit the php file deleting this […]
[…] the online invoice as well, without the need to edit the template, just editing a setting in our Custom module to manage hooks settings and uploading this […]
[…] This hook requires WHMCS API CreateToDo to work properly and our free Custom module to manage hooks settings. […]
[…] plugin requires the Custom module to manage hooks settings which you can download for free from our website. You will need to add the setting […]
[…] This hook requires WHMCS API CreateToDo to work properly and our free Custom module to manage hooks settings. […]
[…] hook requires the Custom module to manage hooks settings that you can download for […]