For future interest, my final *hacked* implementation:
I used the "Admin Name" field as a container for all my custom fields. I could not use either the "Script" or the "Directory" fields as they are used by Softaculous before control is dropped to the script's install.php file.
I added the following __parseFieldContainer() method to my custom install.php to extract the fields I needed and restore the proper Admin Name. This must be called first (or very early) in the execution of install.php to avoid conflicts.
PHP Code function __parseFieldContainer(){
global $__settings, $error, $software, $globals;
$fields = explode("mn3GDv", $__settings['admin_username']);
if (count($fields) == 2) {
$__settings['admin_username'] = $fields[0];
$__settings['my_custom_field'] = $fields[1];
}
else {
die('This script must be installed through WHMCS Checkout.');
}
}
Note that I used the crazy string "mn3GDv" as my delimiter. I initially tried both commas and pipes both literally and HTTP encoded, but they were not being passed through correctly. I instead opted for this random string.
Finally, to wire up WHMCS, I used Javascript ontop of the order form to hide the real "Admin_Name" input and instead display a fake "xxxAdmin" input along with my custom input. Then I use a Javascript event to concatenate the two values on change delimited by my random string.
I know, its a bit of a hack, but it works.
Happy Hacking
Best,
Todd.
|